Skip to content

Fix spawn protection check to handle radius <= 0#210

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-land-creation-protection-issue
Draft

Fix spawn protection check to handle radius <= 0#210
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-land-creation-protection-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 9, 2026

When server-spawn-protection-radius is set to 0, large dominions that encompass the world spawn point are incorrectly rejected with a spawn protection conflict error. Small dominions and expansions work fine.

Root cause: The guard only checked == -1. With radius 0, a degenerate zero-size cuboid is created at spawn, and intersectWith() still returns true when the dominion contains that point.

// Before: only -1 skipped the check
if (spawnProtection == -1) { return; }

// After: 0 and negative values all skip
if (spawnProtection <= 0) { return; }
  • Asserts.assertDominionIntersect(): changed guard from == -1 to <= 0
  • Configuration.serverSpawnProtectionRadius: updated comment to document that 0 or -1 disables the check

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • jitpack.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 (dns block)
  • repo.papermc.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] 选地过大则始终提示出生点保护</issue_title>
<issue_description>## 🐛 BUG描述
我在配置文件已更改server-spawn-protection-radius: 0,或者也尝试过server-spawn-protection-radius: -1,但是玩家当创建的领地比较大时则会显示“创建领地 失败,原因:领地 与出生点保护冲突”。但如果玩家先创建一个小领地再扩建则不会如此提示。

📋 复现步骤

我在配置文件已更改server-spawn-protection-radius: 0,或者也尝试过server-spawn-protection-radius: -1,但是玩家当创建的领地比较大时则会显示“创建领地 失败,原因:领地 与出生点保护冲突”。但如果玩家先创建一个小领地再扩建则不会如此提示。

✅ 期望行为

正常创建领地

❌ 实际行为

提示出生点保护

📷 截图/视频

🖥️ 运行环境

服务器信息:

  • 操作系统: Ubuntu 24.04.03
  • 服务端核心: Folia
  • 服务端版本: 1.21.11
  • Java版本: Java21
  • 插件列表: [请列出所有已安装的插件,特别是与Dominion相关的插件]

插件信息:

  • Dominion版本: [例如: 4.7.5-release-lite]
  • 其他相关插件: [如果有的话,列出可能冲突的插件]

客户端信息:

  • 客户端版本: 测试过的所有版本均出现
  • 客户端类型: 原版

📝 错误日志

在这里上传错误日志

🔧 配置文件

点击展开配置文件
# This is the configuration file of Dominion.
# For more information, please refer to the documentation.
# https://dominion.lunadeer.cn/en/notes/doc/owner/config-ref/overview/
#
# If you want to control player's privilege, please refer to the limitations configuration.

# Do not modify this value.
version: 2
# The settings of the database.
database:
 
  type: mysql
# The settings of the multi server.
# If you have multiple servers proxied by BungeeCord, you can configure and enable this.
# Player can manage/teleport across multi-servers.
# Database with type sqlite is not supported in multi-server mode.
# For migration of existing data, please refer to the documentation.
# https://dominion.lunadeer.cn/notes/doc/owner/other/multi-server/
multi-server:
  # Enable multi server mode.
  enable: true
  # The name of this server.
  # This should be the same as configured in BC (Velocity).
  server-name: xiath
  # The id of this server, must be unique among all servers.
  # Must be positive integer. > 0
  # DO NOT CHANGE THIS AFTER THERE ARE DATA IN THE DATABASE.
  server-id: 1
# Language of the plugin, see others in the plugins/Dominion/languages folder.
language: zh_cn
# Radius of the auto create dominion. -1 to disable.
auto-create-radius: 10
# If player don't login for this days, his dominion will be auto cleaned.
# Set to -1 to disable.
auto-clean-after-days: 180
# Prevent player from creating dominion around the spawn point.
server-spawn-protection-radius: 0
# Tool used to select position for creating dominion.
select-tool: wooden_hoe
# Tool used to show information of clicked dominion.
info-tool: bowl
# The settings of the player default using UI. (For bedrock player, will always be CUI.)
# If set to CUI or TUI, player can not change their UI type.
# BY_PLAYER: Decide by player themselves.
# CUI: Chest GUI.
# TUI: Text GUI.
default-ui-type: BY_PLAYER
# The settings of the plugin message.
plugin-message:
  # The default message when player enter/leave dominion.
  # Variables: {OWNER} - owner of the dominion, {DOM} - name of the dominion.
  default-enter-message: '欢迎来到{DOM}'
  default-leave-message: '期待再见{DOM}'
  # Where to show the message.
  # Supported types: BOSS_BAR, ACTION_BAR, TITLE, SUBTITLE, CHAT
  no-permission-display-place: CHAT
  enter-leave-display-place: TITLE
# Weather the player can migrate residence data to dominion.
residence-migration: false
# Weather the player have dominion.admin permission can bypass the dominion limitation.
admin-bypass: true
# The settings of the group title.
# Player can use there group name as title in tab list.
group-title:
  enable: false
  prefix: '['
  suffix: ']'
# The settings of the external link.
external-links:
  command-help: ''
  documentation: https://dominion.lunadeer.cn/notes/doc/player/
# Player with these permission nodes won't be affected by dominion's fly limitation.
fly-permission-nodes:
- essentials.fly
- cmi.command.fly
# Check for updates by internet.
check-update: false
# Debug mode, if report bugs turn this on.
debug: false
# Performance recorder, don't open this unless you are debugging.
timer: false

📋 额外信息

自安装起,便有此bug

✅ 检查清单

  • [ 1] 我已经搜索了现有的issues,确认这不是重复报告
  • [1 ] 我使用的是最新版本的插件
  • [1 ] 我已经提供了完整的错误日志(如果有)
  • [1 ] 我已经提供了详细的复现步骤
  • [1 ] 我已经填写了完整的运行环境信息
    </issue_description>

<agent_instructions>请帮我分析一下这个issue可能是什么原因造成的</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@ColdeZhang 比较大 具体是多大

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…= -1

Co-authored-by: ColdeZhang <29792376+ColdeZhang@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix land creation issue with spawn point protection Fix spawn protection check to handle radius <= 0 Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 选地过大则始终提示出生点保护

2 participants